package com.example.demo1.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.awt.*;

@Configuration
public class ResourceConfig implements WebMvcConfigurer {
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //addResourceHandler()里配置需要映射的文件夹，此处代表映射文件夹下的所有资源。
        //addResourceLocations()配置文件夹在系统中的路径，使用绝对路径，格式为“file:你的路径”
        registry.addResourceHandler("/coverImg/**").addResourceLocations("file:C:/Users/jizhaoyang/Documents/idea_project/webproject/demo1/src/main/resources/static/coverImg/");
        registry.addResourceHandler("/userPic/**").addResourceLocations("file:C:/Users/jizhaoyang/Documents/idea_project/webproject/demo1/src/main/resources/static/userPic/");
    }
}